package com.linkstec.concurrent;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class ForkJoinPoolTest {
	private static final Logger logger = LogManager.getLogger();
   public static void main(String[] args) {
       MyTask mt = new MyTask(1);

       ForkJoinPool forkJoinPool = new ForkJoinPool();

       Future<Integer> result = forkJoinPool.submit(mt);

       try {
    	   logger.info(result.get());
       } catch (InterruptedException e) {
           e.printStackTrace();
       } catch (ExecutionException e) {
           e.printStackTrace();
       }

       forkJoinPool.shutdown();
   }
}